//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.ScientificWorkflow.UIDesigner
{
    using System;
    using System.Runtime.InteropServices;

    /// <summary>
    /// Holder for native methods
    /// </summary>
    internal static class NativeMethods
    {
        /// <summary>
        /// Native method to extract icon spcified by the index from the resource file
        /// </summary>
        /// <param name="handleToInstance">handle to the application instance</param>
        /// <param name="exeFileName">exe or dll file path</param>
        /// <param name="iconIndex">icon index</param>
        /// <returns>handle to the byte array</returns>
        [DllImport("shell32.dll", EntryPoint = "ExtractIconA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true, BestFitMapping=false)]
        internal static extern IntPtr ExtractIcon(int handleToInstance, string exeFileName, int iconIndex);
    }
}
